]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
cleanup: Only omit braces for single-line blocks
authorFlorian Müllner <fmuellner@gnome.org>
Tue, 20 Aug 2019 00:51:42 +0000 (02:51 +0200)
committerGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>
Mon, 11 Nov 2019 19:25:14 +0000 (19:25 +0000)
Braces can be avoided when a block consists of a single statement,
but readability suffers when the statement spans more than a single
line.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/805

46 files changed:
js/gdm/authPrompt.js
js/misc/extensionUtils.js
js/misc/introspect.js
js/misc/params.js
js/misc/systemActions.js
js/misc/util.js
js/perf/core.js
js/ui/altTab.js
js/ui/appDisplay.js
js/ui/audioDeviceSelection.js
js/ui/backgroundMenu.js
js/ui/barLevel.js
js/ui/calendar.js
js/ui/closeDialog.js
js/ui/components/networkAgent.js
js/ui/components/telepathyClient.js
js/ui/ctrlAltTab.js
js/ui/dash.js
js/ui/dateMenu.js
js/ui/dnd.js
js/ui/endSessionDialog.js
js/ui/environment.js
js/ui/ibusCandidatePopup.js
js/ui/iconGrid.js
js/ui/inhibitShortcutsDialog.js
js/ui/keyboard.js
js/ui/layout.js
js/ui/magnifier.js
js/ui/messageList.js
js/ui/messageTray.js
js/ui/mpris.js
js/ui/notificationDaemon.js
js/ui/osdWindow.js
js/ui/overviewControls.js
js/ui/panel.js
js/ui/popupMenu.js
js/ui/screenShield.js
js/ui/search.js
js/ui/sessionMode.js
js/ui/shellMountOperation.js
js/ui/status/accessibility.js
js/ui/status/keyboard.js
js/ui/status/network.js
js/ui/status/thunderbolt.js
js/ui/viewSelector.js
js/ui/workspaceThumbnail.js

index 0d12e9d1ab1e6d8902099a1ea5b400e179275170..4951741e3b56bb5c9ab60c0e52bcfa01b9cbdb4d 100644 (file)
@@ -330,15 +330,16 @@ var AuthPrompt = GObject.registerClass({
             if (isSpinner)
                 this._spinner.play();
 
-            if (!animate)
+            if (!animate) {
                 actor.opacity = 255;
-            else
+            } else {
                 actor.ease({
                     opacity: 255,
                     duration: DEFAULT_BUTTON_WELL_ANIMATION_TIME,
                     delay: DEFAULT_BUTTON_WELL_ANIMATION_DELAY,
                     mode: Clutter.AnimationMode.LINEAR
                 });
+            }
         }
 
         this._defaultButtonWellActor = actor;
index 2b3c11704fdc1e88796168fefaa7114814475d48..939984fe0ff27a4f99090a6161215cf73f13c684 100644 (file)
@@ -128,12 +128,13 @@ function getSettings(schema) {
     // SYSTEM extension that has been installed in the same prefix as the shell
     let schemaDir = extension.dir.get_child('schemas');
     let schemaSource;
-    if (schemaDir.query_exists(null))
+    if (schemaDir.query_exists(null)) {
         schemaSource = GioSSS.new_from_directory(schemaDir.get_path(),
                                                  GioSSS.get_default(),
                                                  false);
-    else
+    } else {
         schemaSource = GioSSS.get_default();
+    }
 
     let schemaObj = schemaSource.lookup(schema, true);
     if (!schemaObj)
index f256555cb89c505242dde17485911a3f0ec9b8d0..0d1e47bc871100f33860b47e84d7f2e0493d74aa 100644 (file)
@@ -164,9 +164,10 @@ var IntrospectService = class {
                 if (wmClass != null)
                     windowsList[windowId]['wm-class'] = GLib.Variant.new('s', wmClass);
 
-                if (sandboxedAppId != null)
+                if (sandboxedAppId != null) {
                     windowsList[windowId]['sandboxed-app-id'] =
                         GLib.Variant.new('s', sandboxedAppId);
+                }
             }
         }
         invocation.return_value(new GLib.Variant('(a{ta{sv}})', [windowsList]));
index 92adeb006453e86fbbd1660eab479121ed6cba74..817d66ceb877cb5089916496ab3ab2ec6db1da89 100644 (file)
 // @params and @defaults
 function parse(params = {}, defaults, allowExtras) {
     if (!allowExtras) {
-        for (let prop in params)
+        for (let prop in params) {
             if (!(prop in defaults))
                 throw new Error(`Unrecognized parameter "${prop}"`);
+        }
     }
 
     let defaultsCopy = Object.assign({}, defaults);
index 7607efc65f6485024ffdc41717b215ef76b4179c..2f23ada1cf1268cb903af34e722592833a8afb8f 100644 (file)
@@ -233,9 +233,10 @@ const SystemActions = GObject.registerClass({
 
     _updateOrientationLock() {
         let available = false;
-        if (this._sensorProxy.g_name_owner)
+        if (this._sensorProxy.g_name_owner) {
             available = this._sensorProxy.HasAccelerometer &&
                         this._monitorManager.get_is_builtin_display_on();
+        }
 
         this._actions.get(LOCK_ORIENTATION_ACTION_ID).available = available;
 
@@ -273,9 +274,10 @@ const SystemActions = GObject.registerClass({
 
         let results = [];
 
-        for (let [key, { available, keywords }] of this._actions)
+        for (let [key, { available, keywords }] of this._actions) {
             if (available && terms.every(t => keywords.some(k => k.startsWith(t))))
                 results.push(key);
+        }
 
         return results;
     }
index a9194e3a0cf42e3e39161b248a308fbfb82a829c..d40597f7e44adb0215d4fec6f719d330c44d2a00 100644 (file)
@@ -171,23 +171,28 @@ function formatTimeSpan(date) {
 
     if (minutesAgo < 5)
         return _("Just now");
-    if (hoursAgo < 1)
+    if (hoursAgo < 1) {
         return Gettext.ngettext("%d minute ago",
                                 "%d minutes ago", minutesAgo).format(minutesAgo);
-    if (daysAgo < 1)
+    }
+    if (daysAgo < 1) {
         return Gettext.ngettext("%d hour ago",
                                 "%d hours ago", hoursAgo).format(hoursAgo);
+    }
     if (daysAgo < 2)
         return _("Yesterday");
-    if (daysAgo < 15)
+    if (daysAgo < 15) {
         return Gettext.ngettext("%d day ago",
                                 "%d days ago", daysAgo).format(daysAgo);
-    if (weeksAgo < 8)
+    }
+    if (weeksAgo < 8) {
         return Gettext.ngettext("%d week ago",
                                 "%d weeks ago", weeksAgo).format(weeksAgo);
-    if (yearsAgo < 1)
+    }
+    if (yearsAgo < 1) {
         return Gettext.ngettext("%d month ago",
                                 "%d months ago", monthsAgo).format(monthsAgo);
+    }
     return Gettext.ngettext("%d year ago",
                             "%d years ago", yearsAgo).format(yearsAgo);
 }
index d731890b775c7526ffc3514f64f8092588e0b81e..afd03cd1610dc8275ff982449eda5d8d607cee98 100644 (file)
@@ -94,11 +94,12 @@ function *run() {
             let config = WINDOW_CONFIGS[i / 2];
             yield Scripting.destroyTestWindows();
 
-            for (let k = 0; k < config.count; k++)
+            for (let k = 0; k < config.count; k++) {
                 yield Scripting.createTestWindow({ width: config.width,
                                                    height: config.height,
                                                    alpha: config.alpha,
                                                    maximized: config.maximized });
+            }
 
             yield Scripting.waitTestWindows();
             yield Scripting.sleep(1000);
index cedd19855905f69ead34bb4982c324240aade470..603e9b56be8153c81e176898fec10b35526af75a 100644 (file)
@@ -997,9 +997,10 @@ class WindowIcon extends St.BoxLayout {
             size = WINDOW_PREVIEW_SIZE;
             this._icon.add_actor(_createWindowClone(mutterWindow, size * scaleFactor));
 
-            if (this.app)
+            if (this.app) {
                 this._icon.add_actor(this._createAppIcon(this.app,
                                                          APP_ICON_SIZE_SMALL));
+            }
             break;
 
         case AppIconMode.APP_ICON_ONLY:
index c0cb047f064ac8b84090044abc3b4b7e3545e2d8..fa8952e4e1f5571f298f65f48c85c3ead61473c0 100644 (file)
@@ -55,9 +55,10 @@ function _getCategories(info) {
 }
 
 function _listsIntersect(a, b) {
-    for (let itemA of a)
+    for (let itemA of a) {
         if (b.includes(itemA))
             return true;
+    }
     return false;
 }
 
@@ -525,13 +526,14 @@ var AllView = GObject.registerClass({
         super.animateSwitch(animationDirection);
 
         if (this._currentPopup && this._displayingPopup &&
-            animationDirection == IconGrid.AnimationDirection.OUT)
+            animationDirection == IconGrid.AnimationDirection.OUT) {
             this._currentPopup.ease({
                 opacity: 0,
                 duration: VIEWS_SWITCH_TIME,
                 mode: Clutter.AnimationMode.EASE_OUT_QUAD,
                 onComplete: () => (this.opacity = 255)
             });
+        }
 
         if (animationDirection == IconGrid.AnimationDirection.OUT)
             this._pageIndicators.animateIndicators(animationDirection);
@@ -2478,11 +2480,12 @@ var AppIconMenu = class AppIconMenu extends PopupMenu.PopupMenu {
             w => !w.skip_taskbar
         );
 
-        if (windows.length > 0)
+        if (windows.length > 0) {
             this.addMenuItem(
                 /* Translators: This is the heading of a list of open windows */
                 new PopupMenu.PopupSeparatorMenuItem(_("Open Windows"))
             );
+        }
 
         windows.forEach(window => {
             let title = window.title
index f8c8ea6baf9a45532a5fff68c4c940d4a80275cb..3a411881b7b1e305d8b55a328a84f02d0bef835a 100644 (file)
@@ -49,9 +49,10 @@ var AudioDeviceSelectionDialog = GObject.registerClass({
         });
         this.contentLayout.add_child(this._selectionBox);
 
-        if (Main.sessionMode.allowSettings)
+        if (Main.sessionMode.allowSettings) {
             this.addButton({ action: this._openSettings.bind(this),
                              label: _("Sound Settings") });
+        }
         this.addButton({ action: this.close.bind(this),
                          label: _("Cancel"),
                          key: Clutter.KEY_Escape });
index 33e9416cbd55e74d82c0794cfb266406cc2406be..bbe8b3681503379fa7777d278169ca2c52218c08 100644 (file)
@@ -36,10 +36,11 @@ function addBackgroundMenu(actor, layoutManager) {
 
     let clickAction = new Clutter.ClickAction();
     clickAction.connect('long-press', (action, theActor, state) => {
-        if (state == Clutter.LongPressState.QUERY)
+        if (state == Clutter.LongPressState.QUERY) {
             return ((action.get_button() == 0 ||
                      action.get_button() == 1) &&
                     !actor._backgroundMenu.isOpen);
+        }
         if (state == Clutter.LongPressState.ACTIVATE) {
             let [x, y] = action.get_coords();
             openMenu(x, y);
index 89f9d62d64b61cb317561ec57d56e54a2549bf7f..a2baffd93f628b1f31468949ab47ed6acf5371ea 100644 (file)
@@ -88,9 +88,10 @@ var BarLevel = GObject.registerClass({
         if (this._overdriveStart == value)
             return;
 
-        if (value > this._maxValue)
+        if (value > this._maxValue) {
             throw new Error(`Tried to set overdrive value to ${value}, ` +
                 `which is a number greater than the maximum allowed value ${this._maxValue}`);
+        }
 
         this._overdriveStart = value;
         this.notify('overdrive-start');
index 107c0961461d30752ac549864eacdad4190068cc..6e20bf98ef468689a02e2b7625c32426b8de5e47 100644 (file)
@@ -777,11 +777,12 @@ class NotificationMessage extends MessageList.Message {
     }
 
     _getIcon() {
-        if (this.notification.gicon)
+        if (this.notification.gicon) {
             return new St.Icon({ gicon: this.notification.gicon,
                                  icon_size: MESSAGE_ICON_SIZE });
-        else
+        } else {
             return this.notification.source.createIcon(MESSAGE_ICON_SIZE);
+        }
     }
 
     _onUpdated(n, _clear) {
@@ -860,14 +861,15 @@ class EventsSection extends MessageList.MessageListSection {
 
         let dayFormat;
         let now = new Date();
-        if (sameYear(this._date, now))
+        if (sameYear(this._date, now)) {
             /* Translators: Shown on calendar heading when selected day occurs on current year */
             dayFormat = Shell.util_translate_time_string(NC_("calendar heading",
                                                              "%A, %B %-d"));
-        else
+        } else {
             /* Translators: Shown on calendar heading when selected day occurs on different year */
             dayFormat = Shell.util_translate_time_string(NC_("calendar heading",
                                                              "%A, %B %-d, %Y"));
+        }
         this._title.label = this._date.toLocaleFormat(dayFormat);
     }
 
index 4d43196ba6cf03fc2dc6bb230b5665451835d7ef..15222e5b62c95b32b6d597737f7eb53990ae9a6f 100644 (file)
@@ -124,11 +124,12 @@ var CloseDialog = GObject.registerClass({
         if (this._tracked === shouldTrack)
             return;
 
-        if (shouldTrack)
+        if (shouldTrack) {
             Main.layoutManager.trackChrome(this._dialog,
                                            { affectsInputRegion: true });
-        else
+        } else {
             Main.layoutManager.untrackChrome(this._dialog);
+        }
 
         // The buttons are broken when they aren't added to the input region,
         // so disable them properly in that case
index 57a8b41fae4b623a7642290eb2ded018da85e772..c31af2177efb031cbf090d9eaa3cdf2e553be03c 100644 (file)
@@ -222,11 +222,12 @@ class NetworkSecretDialog extends ModalDialog.ModalDialog {
                            validate: this._validateStaticWep, password: true });
             break;
         case 'ieee8021x':
-            if (wirelessSecuritySetting.auth_alg == 'leap') // Cisco LEAP
+            if (wirelessSecuritySetting.auth_alg == 'leap') { // Cisco LEAP
                 secrets.push({ label: _("Password: "), key: 'leap-password',
                                value: wirelessSecuritySetting.leap_password || '', password: true });
-            else // Dynamic (IEEE 802.1x) WEP
+            } else { // Dynamic (IEEE 802.1x) WEP
                 this._get8021xSecrets(secrets);
+            }
             break;
         case 'wpa-eap':
             this._get8021xSecrets(secrets);
@@ -241,15 +242,18 @@ class NetworkSecretDialog extends ModalDialog.ModalDialog {
 
         /* If hints were given we know exactly what we need to ask */
         if (this._settingName == "802-1x" && this._hints.length) {
-            if (this._hints.includes('identity'))
+            if (this._hints.includes('identity')) {
                 secrets.push({ label: _("Username: "), key: 'identity',
                                value: ieee8021xSetting.identity || '', password: false });
-            if (this._hints.includes('password'))
+            }
+            if (this._hints.includes('password')) {
                 secrets.push({ label: _("Password: "), key: 'password',
                                value: ieee8021xSetting.password || '', password: true });
-            if (this._hints.includes('private-key-password'))
+            }
+            if (this._hints.includes('private-key-password')) {
                 secrets.push({ label: _("Private key password: "), key: 'private-key-password',
                                value: ieee8021xSetting.private_key_password || '', password: true });
+            }
             return;
         }
 
index 90fc03ca8448cc2ce771e2e19145e91ea735daad..69b6f606e3920b5d68d57b96f500f2fc20843197 100644 (file)
@@ -231,11 +231,12 @@ class TelepathyClient extends Tp.BaseClient {
             return;
         }
 
-        if (chanType == Tp.IFACE_CHANNEL_TYPE_TEXT)
+        if (chanType == Tp.IFACE_CHANNEL_TYPE_TEXT) {
             this._approveTextChannel(account, conn, channel, dispatchOp, context);
-        else
+        } else {
             context.fail(new Tp.Error({ code: Tp.Error.INVALID_ARGUMENT,
                                         message: 'Unsupported channel type' }));
+        }
     }
 
     _approveTextChannel(account, conn, channel, dispatchOp, context) {
@@ -386,10 +387,11 @@ class ChatSource extends MessageTray.Source {
 
     _updateAvatarIcon() {
         this.iconUpdated();
-        if (this._notifiction)
+        if (this._notifiction) {
             this._notification.update(this._notification.title,
                                       this._notification.bannerBodyText,
                                       { gicon: this.getIcon() });
+        }
     }
 
     open() {
@@ -601,10 +603,11 @@ class ChatSource extends MessageTray.Source {
     }
 
     _presenceChanged(_contact, _presence, _status, _message) {
-        if (this._notification)
+        if (this._notification) {
             this._notification.update(this._notification.title,
                                       this._notification.bannerBodyText,
                                       { secondaryGIcon: this.getSecondaryIcon() });
+        }
     }
 
     _pendingRemoved(channel, message) {
@@ -674,10 +677,11 @@ var ChatNotification = HAVE_TP ? GObject.registerClass({
             styles.push('chat-action');
         }
 
-        if (message.direction == NotificationDirection.RECEIVED)
+        if (message.direction == NotificationDirection.RECEIVED) {
             this.update(this.source.title, messageBody,
                         { datetime: GLib.DateTime.new_from_unix_local(message.timestamp),
                           bannerMarkup: true });
+        }
 
         let group = (message.direction == NotificationDirection.RECEIVED
             ? 'received' : 'sent');
index b7b3939af9573791d42ac09e0495294fa0acda44..e8f548b3bae3452f634c5edb58a388fbd9815e68 100644 (file)
@@ -90,12 +90,13 @@ var CtrlAltTabManager = class CtrlAltTabManager {
                     iconName = 'video-display-symbolic';
                 } else {
                     let app = windowTracker.get_window_app(windows[i]);
-                    if (app)
+                    if (app) {
                         icon = app.create_icon_texture(POPUP_APPICON_SIZE);
-                    else
+                    } else {
                         icon = textureCache.bind_cairo_surface_property(windows[i],
                                                                         'icon',
                                                                         POPUP_APPICON_SIZE);
+                    }
                 }
 
                 items.push({ name: windows[i].title,
index 760c23df5c1fb5848ff9ed5908855defa3de6483..fa9d14ae76333c4c95581c427b733af61352c58a 100644 (file)
@@ -728,9 +728,10 @@ var Dash = GObject.registerClass({
             }
         }
 
-        for (let i = 0; i < addedItems.length; i++)
+        for (let i = 0; i < addedItems.length; i++) {
             this._box.insert_child_at_index(addedItems[i].item,
                                             addedItems[i].pos);
+        }
 
         for (let i = 0; i < removedActors.length; i++) {
             let item = removedActors[i];
index 224366c4516039c250eb5ade99a5d180d01636fb..4d8189b4de3786b08547e1488f66acf849b947df 100644 (file)
@@ -203,9 +203,10 @@ class WorldClocksSection extends St.Button {
         }
 
         if (this._grid.get_n_children() > 1) {
-            if (!this._clockNotifyId)
+            if (!this._clockNotifyId) {
                 this._clockNotifyId =
                     this._clock.connect('notify::clock', this._updateLabels.bind(this));
+            }
             this._updateLabels();
         } else {
             if (this._clockNotifyId)
index fc7d22880766cdffca79faab3160750a7416df76..167374eda3b235c0b5bf7076705b635105d14fd0 100644 (file)
@@ -61,11 +61,12 @@ function addDragMonitor(monitor) {
 }
 
 function removeDragMonitor(monitor) {
-    for (let i = 0; i < dragMonitors.length; i++)
+    for (let i = 0; i < dragMonitors.length; i++) {
         if (dragMonitors[i] == monitor) {
             dragMonitors.splice(i, 1);
             return;
         }
+    }
 }
 
 var _Draggable = class _Draggable {
@@ -555,7 +556,7 @@ var _Draggable = class _Draggable {
         };
         for (let i = 0; i < dragMonitors.length; i++) {
             let dropFunc = dragMonitors[i].dragDrop;
-            if (dropFunc)
+            if (dropFunc) {
                 switch (dropFunc(dropEvent)) {
                 case DragDropResult.FAILURE:
                 case DragDropResult.SUCCESS:
@@ -563,6 +564,7 @@ var _Draggable = class _Draggable {
                 case DragDropResult.CONTINUE:
                     continue;
                 }
+            }
         }
 
         // At this point it is too late to cancel a drag by destroying
index c87cf59dd1bf3e76037f86e1144ec0523752aff0..86115af430339173b1940050119991a2c3e2d57a 100644 (file)
@@ -681,11 +681,12 @@ class EndSessionDialog extends ModalDialog.ModalDialog {
                     continue;
 
                 let sessionId = GLib.getenv('XDG_SESSION_ID');
-                if (!sessionId)
+                if (!sessionId) {
                     this._loginManager.getCurrentSessionProxy(currentSessionProxy => {
                         sessionId = currentSessionProxy.Id;
                         log(`endSessionDialog: No XDG_SESSION_ID, fetched from logind: ${sessionId}`);
                     });
+                }
 
                 if (proxy.Id == sessionId)
                     continue;
index b4e8cf93f6b112512df2f88568e4e1ebeb38e86e..6689fe555e90ec99d9233d22542868be1ca9b10f 100644 (file)
@@ -40,7 +40,7 @@ function _patchContainerClass(containerClass) {
 }
 
 function _patchLayoutClass(layoutClass, styleProps) {
-    if (styleProps)
+    if (styleProps) {
         layoutClass.prototype.hookup_style = function (container) {
             container.connect('style-changed', () => {
                 let node = container.get_theme_node();
@@ -51,6 +51,7 @@ function _patchLayoutClass(layoutClass, styleProps) {
                 }
             });
         };
+    }
 }
 
 function _makeEaseCallback(params, cleanup) {
index cdd547d2a7433a53b5c94884332ae9b5b380e614..683e608888280b460a347d665a62e99ce62f2ac6 100644 (file)
@@ -215,9 +215,10 @@ class IbusCandidatePopup extends BoxPointer.BoxPointer {
             this._preeditText.text = text.get_text();
 
             let attrs = text.get_attributes();
-            if (attrs)
+            if (attrs) {
                 this._setTextAttributes(this._preeditText.clutter_text,
                                         attrs);
+            }
         });
         panelService.connect('show-preedit-text', () => {
             this._preeditText.show();
@@ -316,8 +317,9 @@ class IbusCandidatePopup extends BoxPointer.BoxPointer {
 
     _setTextAttributes(clutterText, ibusAttrList) {
         let attr;
-        for (let i = 0; (attr = ibusAttrList.get(i)); ++i)
+        for (let i = 0; (attr = ibusAttrList.get(i)); ++i) {
             if (attr.get_attr_type() == IBus.AttrType.BACKGROUND)
                 clutterText.set_selection(attr.get_start_index(), attr.get_end_index());
+        }
     }
 });
index dbde037634bf67feff69f715cfe7b9c33243dd99..7187f520eb4214b24c94eed62fb79e21d9c66d5a 100644 (file)
@@ -455,9 +455,10 @@ var IconGrid = GObject.registerClass({
     }
 
     animatePulse(animationDirection) {
-        if (animationDirection != AnimationDirection.IN)
+        if (animationDirection != AnimationDirection.IN) {
             throw new GObject.NotImplementedError("Pulse animation only implements " +
                                                   "'in' animation direction");
+        }
 
         this._resetAnimationActors();
 
@@ -805,9 +806,10 @@ var IconGrid = GObject.registerClass({
 
             this._updateSpacingForSize(availWidth, availHeight);
         }
-        if (!this._updateIconSizesLaterId)
+        if (!this._updateIconSizesLaterId) {
             this._updateIconSizesLaterId = Meta.later_add(Meta.LaterType.BEFORE_REDRAW,
                                                           this._updateIconSizes.bind(this));
+        }
     }
 
     // Note that this is ICON_SIZE as used by BaseIcon, not elsewhere in IconGrid; it's a bit messed up
index 24699cff05ad7d156560132626c65076dc853c9b..0fd14827ea97fc694fd11d6bd46e34f1b5ae72ed 100644 (file)
@@ -84,10 +84,11 @@ var InhibitShortcutsDialog = GObject.registerClass({
         let contentParams = { icon, title };
 
         let restoreAccel = this._getRestoreAccel();
-        if (restoreAccel)
+        if (restoreAccel) {
             contentParams.subtitle =
                 /* Translators: %s is a keyboard shortcut like "Super+x" */
                 _("You can restore shortcuts by pressing %s.").format(restoreAccel);
+        }
 
         let content = new Dialog.MessageDialogContent(contentParams);
         this._dialog.contentLayout.add_actor(content);
index f51ac777625417b6a9271218a8f3e09c975ff02c..c0a02972ffb475eb35918b3f3e8452c55d5e21ce 100644 (file)
@@ -1307,9 +1307,10 @@ class Keyboard extends St.BoxLayout {
         this._connectSignal(global.stage, 'notify::key-focus',
             this._onKeyFocusChanged.bind(this));
 
-        if (Meta.is_wayland_compositor())
+        if (Meta.is_wayland_compositor()) {
             this._connectSignal(this._keyboardController, 'emoji-visible',
                 this._onEmojiKeyVisible.bind(this));
+        }
 
         this._relayout();
     }
index b1c3d9264681f2f272ac9798a9768f89e7f7cf4c..2943f0600444e02a6f25c59176050085cbb67356 100644 (file)
@@ -339,10 +339,11 @@ var LayoutManager = GObject.registerClass({
 
         this.monitors = [];
         let nMonitors = display.get_n_monitors();
-        for (let i = 0; i < nMonitors; i++)
+        for (let i = 0; i < nMonitors; i++) {
             this.monitors.push(new Monitor(i,
                                            display.get_monitor_geometry(i),
                                            display.get_monitor_scale(i)));
+        }
 
         if (nMonitors == 0) {
             this.primaryIndex = this.bottomIndex = -1;
@@ -970,9 +971,10 @@ var LayoutManager = GObject.registerClass({
         if (this._startingUp)
             return;
 
-        if (!this._updateRegionIdle)
+        if (!this._updateRegionIdle) {
             this._updateRegionIdle = Meta.later_add(Meta.LaterType.BEFORE_REDRAW,
                                                     this._updateRegions.bind(this));
+        }
     }
 
     _getWindowActorsForWorkspace(workspace) {
index e38c3a4176c68805f70ad3a1eb0f9f1bdd5acf44..afec089d5363f45ca0ed2a15649c879a32aa1597 100644 (file)
@@ -771,15 +771,16 @@ var ZoomRegion = class ZoomRegion {
     }
 
     _updateScreenPosition() {
-        if (this._screenPosition == GDesktopEnums.MagnifierScreenPosition.NONE)
+        if (this._screenPosition == GDesktopEnums.MagnifierScreenPosition.NONE) {
             this._setViewPort({
                 x: this._viewPortX,
                 y: this._viewPortY,
                 width: this._viewPortWidth,
                 height: this._viewPortHeight
             });
-        else
+        } else {
             this.setScreenPosition(this._screenPosition);
+        }
     }
 
     _updateFocus(caller, event) {
@@ -1400,11 +1401,12 @@ var ZoomRegion = class ZoomRegion {
         // If in lens mode, move the magnified view such that it is centered
         // over the actual mouse. However, in full screen mode, the "lens" is
         // the size of the screen -- pointless to move such a large lens around.
-        if (this._lensMode && !this._isFullScreen())
+        if (this._lensMode && !this._isFullScreen()) {
             this._setViewPort({ x: this._xCenter - this._viewPortWidth / 2,
                                 y: this._yCenter - this._viewPortHeight / 2,
                                 width: this._viewPortWidth,
                                 height: this._viewPortHeight }, true);
+        }
 
         this._updateCloneGeometry();
         this._updateMousePosition();
index 01f1da485062482adbe9ecaa5361d399831ee3db..195262cf5dfa6e79080807ae678293a57c614692 100644 (file)
@@ -150,10 +150,11 @@ class URLHighlighter extends St.Label {
             findPos = i;
         }
         if (findPos != -1) {
-            for (let i = 0; i < this._urls.length; i++)
+            for (let i = 0; i < this._urls.length; i++) {
                 if (findPos >= this._urls[i].pos &&
                     this._urls[i].pos + this._urls[i].url.length > findPos)
                     return i;
+            }
         }
         return -1;
     }
@@ -170,20 +171,22 @@ class ScaleLayout extends Clutter.BinLayout {
         if (this._container == container)
             return;
 
-        if (this._container)
+        if (this._container) {
             for (let id of this._signals)
                 this._container.disconnect(id);
+        }
 
         this._container = container;
         this._signals = [];
 
-        if (this._container)
+        if (this._container) {
             for (let signal of ['notify::scale-x', 'notify::scale-y']) {
                 let id = this._container.connect(signal, () => {
                     this.layout_changed();
                 });
                 this._signals.push(id);
             }
+        }
     }
 
     vfunc_get_preferred_width(container, forHeight) {
index 4a62cdb6acdfb2c61bd17e3435c16fa1a42ddbe1..695a676bf175aae12780d2b3a7aa950ba1bbf1d3 100644 (file)
@@ -900,9 +900,10 @@ var Source = GObject.registerClass({
     }
 
     destroyNonResidentNotifications() {
-        for (let i = this.notifications.length - 1; i >= 0; i--)
+        for (let i = this.notifications.length - 1; i >= 0; i--) {
             if (!this.notifications[i].resident)
                 this.notifications[i].destroy();
+        }
     }
 });
 
index 2b251546d368111aea220f6257f7906310b7df97..5a936b5af974f0e5f48fdc952b453ed0cc28370e 100644 (file)
@@ -191,28 +191,31 @@ var MprisPlayer = class MprisPlayer {
         this._trackArtists = metadata['xesam:artist'];
         if (!Array.isArray(this._trackArtists) ||
             !this._trackArtists.every(artist => typeof artist === 'string')) {
-            if (typeof this._trackArtists !== 'undefined')
+            if (typeof this._trackArtists !== 'undefined') {
                 log(`Received faulty track artist metadata from ${
                     this._busName}; expected an array of strings, got ${
                     this._trackArtists} (${typeof this._trackArtists})`);
+            }
             this._trackArtists =  [_("Unknown artist")];
         }
 
         this._trackTitle = metadata['xesam:title'];
         if (typeof this._trackTitle !== 'string') {
-            if (typeof this._trackTitle !== 'undefined')
+            if (typeof this._trackTitle !== 'undefined') {
                 log(`Received faulty track title metadata from ${
                     this._busName}; expected a string, got ${
                     this._trackTitle} (${typeof this._trackTitle})`);
+            }
             this._trackTitle = _("Unknown title");
         }
 
         this._trackCoverUrl = metadata['mpris:artUrl'];
         if (typeof this._trackCoverUrl !== 'string') {
-            if (typeof this._trackCoverUrl !== 'undefined')
+            if (typeof this._trackCoverUrl !== 'undefined') {
                 log(`Received faulty track cover art metadata from ${
                     this._busName}; expected a string, got ${
                     this._trackCoverUrl} (${typeof this._trackCoverUrl})`);
+            }
             this._trackCoverUrl = '';
         }
 
index e9109dd51dafca5cb2f50b6e7834ccd59f806c4c..93348567b1dc538e53541127a6fc0d7bb0c8a39c 100644 (file)
@@ -310,12 +310,13 @@ var FdoNotificationDaemon = class FdoNotificationDaemon {
         if (actions.length) {
             for (let i = 0; i < actions.length - 1; i += 2) {
                 let [actionId, label] = [actions[i], actions[i + 1]];
-                if (actionId == 'default')
+                if (actionId == 'default') {
                     hasDefaultAction = true;
-                else
+                } else {
                     notification.addAction(label, () => {
                         this._emitActionInvoked(ndata.id, actionId);
                     });
+                }
             }
         }
 
@@ -427,13 +428,14 @@ class FdoNotificationDaemonSource extends MessageTray.Source {
         else
             this.useNotificationIcon = true;
 
-        if (sender)
+        if (sender) {
             this._nameWatcherId = Gio.DBus.session.watch_name(sender,
                                                               Gio.BusNameWatcherFlags.NONE,
                                                               null,
                                                               this._onNameVanished.bind(this));
-        else
+        } else {
             this._nameWatcherId = 0;
+        }
     }
 
     _createPolicy() {
index a91bcc7b8fb5957de9e97b4b8af85b822effc45f..59dce8621381eecbbdc88eb040749941740a44c1 100644 (file)
@@ -113,13 +113,14 @@ class OsdWindow extends St.Widget {
     setLevel(value) {
         this._level.visible = (value != undefined);
         if (value != undefined) {
-            if (this.visible)
+            if (this.visible) {
                 this._level.ease_property('value', value, {
                     mode: Clutter.AnimationMode.EASE_OUT_QUAD,
                     duration: LEVEL_ANIMATION_TIME
                 });
-            else
+            } else {
                 this._level.value = value;
+            }
         }
     }
 
index a529b83251c29591ba480362d7e64e8a6ec971b1..a97711b0ef3e2d96486cf035b64d912bc588d7e7 100644 (file)
@@ -13,10 +13,10 @@ var SIDE_CONTROLS_ANIMATION_TIME = 160;
 
 function getRtlSlideDirection(direction, actor) {
     let rtl = (actor.text_direction == Clutter.TextDirection.RTL);
-    if (rtl)
+    if (rtl) {
         direction = (direction == SlideDirection.LEFT)
             ? SlideDirection.RIGHT : SlideDirection.LEFT;
-
+    }
     return direction;
 }
 
index 46080987ce94ec1189d8c3b6520117d47bb714e5..f288aaf5d026f5ab2fc0953529d14da247a301eb 100644 (file)
@@ -343,9 +343,10 @@ var AppMenuButton = GObject.registerClass({
         if (focusedApp && focusedApp.is_on_workspace(workspace))
             return focusedApp;
 
-        for (let i = 0; i < this._startingApps.length; i++)
+        for (let i = 0; i < this._startingApps.length; i++) {
             if (this._startingApps[i].is_on_workspace(workspace))
                 return this._startingApps[i];
+        }
 
         return null;
     }
@@ -470,9 +471,10 @@ class ActivitiesButton extends PanelMenu.Button {
 
     vfunc_event(event) {
         if (event.type() == Clutter.EventType.TOUCH_END ||
-            event.type() == Clutter.EventType.BUTTON_RELEASE)
+            event.type() == Clutter.EventType.BUTTON_RELEASE) {
             if (Main.overview.shouldToggleByCornerOrButton())
                 Main.overview.toggle();
+        }
 
         return Clutter.EVENT_PROPAGATE;
     }
@@ -622,14 +624,15 @@ class PanelCorner extends St.DrawingArea {
         cr.setOperator(Cairo.Operator.SOURCE);
 
         cr.moveTo(0, offsetY);
-        if (this._side == St.Side.LEFT)
+        if (this._side == St.Side.LEFT) {
             cr.arc(cornerRadius,
                    borderWidth + cornerRadius,
                    cornerRadius, Math.PI, 3 * Math.PI / 2);
-        else
+        } else {
             cr.arc(0,
                    borderWidth + cornerRadius,
                    cornerRadius, 3 * Math.PI / 2, 2 * Math.PI);
+        }
         cr.lineTo(cornerRadius, offsetY);
         cr.closePath();
 
index 34e0413dddec5b588865438593ae55e259ad21bc..919e3d40892db2e38446c788029044103820326a 100644 (file)
@@ -19,9 +19,10 @@ var Ornament = {
 };
 
 function isPopupMenuItemVisible(child) {
-    if (child._delegate instanceof PopupMenuSection)
+    if (child._delegate instanceof PopupMenuSection) {
         if (child._delegate.isEmpty())
             return false;
+    }
     return child.visible;
 }
 
@@ -809,9 +810,10 @@ var PopupMenu = class extends PopupMenuBase {
         global.focus_manager.add_group(this.actor);
         this.actor.reactive = true;
 
-        if (this.sourceActor)
+        if (this.sourceActor) {
             this._keyPressId = this.sourceActor.connect('key-press-event',
                                                         this._onKeyPress.bind(this));
+        }
 
         this._openedSubMenu = null;
     }
index 3e5ee17e4eb3a9383c28abef262f43fa85d745c1..4629e9fd60d03ed85a837a4c3a85a895e90cb499 100644 (file)
@@ -1044,9 +1044,10 @@ var ScreenShield = class {
             this._animateArrows();
         }
 
-        if (!this._arrowWatchId)
+        if (!this._arrowWatchId) {
             this._arrowWatchId = this.idleMonitor.add_idle_watch(ARROW_IDLE_TIME,
                                                                  this._pauseArrowAnimation.bind(this));
+        }
     }
 
     _pauseArrowAnimation() {
index af927fc57761625a48dee422ff1c609ce1427112..fe62f104e690fefd89977f729c3dad2f1aaf8d2e 100644 (file)
@@ -53,9 +53,10 @@ class SearchResult extends St.Button {
     activate() {
         this.provider.activateResult(this.metaInfo.id, this._resultsView.terms);
 
-        if (this.metaInfo.clipboardText)
+        if (this.metaInfo.clipboardText) {
             St.Clipboard.get_default().set_text(
                 St.ClipboardType.CLIPBOARD, this.metaInfo.clipboardText);
+        }
         Main.overview.toggle();
     }
 });
@@ -549,19 +550,20 @@ var SearchResultsView = GObject.registerClass({
             provider.searchInProgress = true;
 
             let previousProviderResults = previousResults[provider.id];
-            if (this._isSubSearch && previousProviderResults)
+            if (this._isSubSearch && previousProviderResults) {
                 provider.getSubsearchResultSet(previousProviderResults,
                                                this._terms,
                                                results => {
                                                    this._gotResults(results, provider);
                                                },
                                                this._cancellable);
-            else
+            } else {
                 provider.getInitialResultSet(this._terms,
                                              results => {
                                                  this._gotResults(results, provider);
                                              },
                                              this._cancellable);
+            }
         });
 
         this._updateSearchProgress();
index e47bb97b13d7f252f6d46464a62462d25192c502..220ea61239d764a9880f58974ff8946a81d17c96 100644 (file)
@@ -143,9 +143,10 @@ function listModes() {
     let loop = new GLib.MainLoop(null, false);
     let id = GLib.idle_add(GLib.PRIORITY_DEFAULT, () => {
         let names = Object.getOwnPropertyNames(_modes);
-        for (let i = 0; i < names.length; i++)
+        for (let i = 0; i < names.length; i++) {
             if (_modes[names[i]].isPrimary)
                 print(names[i]);
+        }
         loop.quit();
     });
     GLib.Source.set_name_by_id(id, '[gnome-shell] listModes');
@@ -188,11 +189,12 @@ var SessionMode = class {
     _sync() {
         let params = _modes[this.currentMode];
         let defaults;
-        if (params.parentMode)
+        if (params.parentMode) {
             defaults = Params.parse(_modes[params.parentMode],
                                     _modes[DEFAULT_MODE]);
-        else
+        } else {
             defaults = _modes[DEFAULT_MODE];
+        }
         params = Params.parse(params, defaults);
 
         // A simplified version of Lang.copyProperties, handles
index f8bda055f74aecf53f8e99a8539bcf1e7ce35077..db9bdd11854fce9629def5c27634cfbc76707c2e 100644 (file)
@@ -474,15 +474,16 @@ var ShellMountPasswordDialog = GObject.registerClass({
 
     _onOpenDisksButton() {
         let app = Shell.AppSystem.get_default().lookup_app('org.gnome.DiskUtility.desktop');
-        if (app)
+        if (app) {
             app.activate();
-        else
+        } else {
             Main.notifyError(
                 /* Translators: %s is the Disks application */
                 _("Unable to start %s").format(app.get_name()),
                 /* Translators: %s is the Disks application */
                 _("Couldn’t find the %s application").format(app.get_name())
             );
+        }
         this._onCancelButton();
     }
 });
index 6ac7233a1bd935f977eccfd0f7f33a4a053d8c95..6e07118fe233c68a14718a651c4e3af33033b48d 100644 (file)
@@ -101,12 +101,13 @@ class ATIndicator extends PanelMenu.Button {
 
     _buildItemExtended(string, initialValue, writable, onSet) {
         let widget = new PopupMenu.PopupSwitchMenuItem(string, initialValue);
-        if (!writable)
+        if (!writable) {
             widget.reactive = false;
-        else
+        } else {
             widget.connect('toggled', item => {
                 onSet(item.state);
             });
+        }
         return widget;
     }
 
@@ -178,11 +179,12 @@ class ATIndicator extends PanelMenu.Button {
             initialSetting,
             settings.is_writable(KEY_TEXT_SCALING_FACTOR),
             enabled => {
-                if (enabled)
+                if (enabled) {
                     settings.set_double(
                         KEY_TEXT_SCALING_FACTOR, DPI_FACTOR_LARGE);
-                else
+                } else {
                     settings.reset(KEY_TEXT_SCALING_FACTOR);
+                }
             });
 
         settings.connect(`changed::${KEY_TEXT_SCALING_FACTOR}`, () => {
index 1180e258c5b2e920300cb9aa1f7b5c6c03666e98..b5751023d4f6a52aa0e4e9e9cf4618c064f8db37 100644 (file)
@@ -437,13 +437,13 @@ var InputSourceManager = class {
 
         this.emit('current-source-changed', oldSource);
 
-        for (let i = 1; i < this._mruSources.length; ++i)
+        for (let i = 1; i < this._mruSources.length; ++i) {
             if (this._mruSources[i] == newSource) {
                 let currentSource = this._mruSources.splice(i, 1);
                 this._mruSources = currentSource.concat(this._mruSources);
                 break;
             }
-
+        }
         this._changePerWindowSource();
     }
 
@@ -516,12 +516,13 @@ var InputSourceManager = class {
 
         let mruSources = [];
         for (let i = 0; i < this._mruSources.length; i++) {
-            for (let j = 0; j < sourcesList.length; j++)
+            for (let j = 0; j < sourcesList.length; j++) {
                 if (this._mruSources[i].type == sourcesList[j].type &&
                     this._mruSources[i].id == sourcesList[j].id) {
                     mruSources = mruSources.concat(sourcesList.splice(j, 1));
                     break;
                 }
+            }
         }
         this._mruSources = mruSources.concat(sourcesList);
     }
index 3835ffbc35ba52cfc7a7887f3936b5b2f9aa3967..6008d642248ebb3506b6196c0f0666a752cd3a86 100644 (file)
@@ -161,9 +161,10 @@ var NMConnectionItem = class {
 
         this._activeConnection = activeConnection;
 
-        if (this._activeConnection)
+        if (this._activeConnection) {
             this._activeConnectionChangedId = this._activeConnection.connect('notify::state',
                                                                              this._connectionStateChanged.bind(this));
+        }
 
         this._sync();
     }
@@ -1441,9 +1442,10 @@ var NMVpnConnectionItem = class extends NMConnectionItem {
 
         this._activeConnection = activeConnection;
 
-        if (this._activeConnection)
+        if (this._activeConnection) {
             this._activeConnectionChangedId = this._activeConnection.connect('vpn-state-changed',
                                                                              this._connectionStateChanged.bind(this));
+        }
 
         this._sync();
     }
index 1424a8b789892ea2e62f49ac8714ac4d271df175..c99cacac943f33818d7420eed88f6de360f62cb7 100644 (file)
@@ -199,9 +199,10 @@ var AuthRobot = class {
          */
         this._enrolling = this._devicesToEnroll.length > 0;
 
-        if (this._enrolling)
+        if (this._enrolling) {
             GLib.idle_add(GLib.PRIORITY_DEFAULT,
                           this._enrollDevicesIdle.bind(this));
+        }
     }
 
     _enrollDevicesIdle() {
index ab238e4454dfe57b6d69945d6d46a1be6b76bba5..4a618057f628d436ccbd69184edc750781307e16 100644 (file)
@@ -310,13 +310,14 @@ var ViewSelector = GObject.registerClass({
 
         let page = new St.Bin({ child: actor });
 
-        if (params.a11yFocus)
+        if (params.a11yFocus) {
             Main.ctrlAltTabManager.addGroup(params.a11yFocus, name, a11yIcon);
-        else
+        } else {
             Main.ctrlAltTabManager.addGroup(actor, name, a11yIcon, {
                 proxy: this,
                 focusCallback: () => this._a11yFocusPage(page),
             });
+        }
         page.hide();
         this.add_actor(page);
         return page;
@@ -524,9 +525,10 @@ var ViewSelector = GObject.registerClass({
 
             this._entry.set_secondary_icon(this._clearIcon);
 
-            if (this._iconClickedId == 0)
+            if (this._iconClickedId == 0) {
                 this._iconClickedId = this._entry.connect('secondary-icon-clicked',
                                                           this.reset.bind(this));
+            }
         } else {
             if (this._iconClickedId > 0) {
                 this._entry.disconnect(this._iconClickedId);
index 8101ae39e46fb6844de124871e5f1649ea25da4c..6f635c5bb61d870edc83f561f71bc220541a4f3e 100644 (file)
@@ -1204,11 +1204,12 @@ var ThumbnailsBox = GObject.registerClass({
     }
 
     _updatePorthole() {
-        if (!Main.layoutManager.primaryMonitor)
+        if (!Main.layoutManager.primaryMonitor) {
             this._porthole = { width: global.stage.width, height: global.stage.height,
                                x: global.stage.x, y: global.stage.y };
-        else
+        } else {
             this._porthole = Main.layoutManager.getWorkAreaForMonitor(Main.layoutManager.primaryIndex);
+        }
 
         this.queue_relayout();
     }